package com.xspace.android.xafcommon.network.task;

import java.util.Date;

import android.content.Context;

import com.xspace.android.xafcommon.network.message.IRequestMsg;
import com.xspace.android.xafcommon.network.message.IResponseMsg;

public interface ITask 
{
    public static final int TASKSTATE_READY=0;     //The new task,has not been running state,or from stop,through the restart into this state
    public static final int TASKSTATE_RUNNING=1;   //Through the start,in operation
    public static final int TASKSTATE_STOPPED=2;   //Through the method of stop,stop state
    public static final int TASKSTATE_END=3;       //The end of the normal operation of task state
    public static final int TASKSTATE_CANCELED=4;  //Through cancel methods cancel
    /*Returns the current state of the task*/
    public int getTaskState();
    
    /**
     * For the response of the task
     * @return ResponseMessage
     */
    public IResponseMsg getResponse();

    /**
     * The request for the task
     * @return RequestMessage
     */
    public IRequestMsg getRequest();
    
    /**
     * Get the context of the task
     * @return Context
     */
    public Context getContext();
    
    public ITaskListener getListener();
    
    /**Task id*/
    public void setTaskId(int taskId);
    
    public int getTaskId();
    
    /**Task submit time*/
    public void setSubmitTime(Date date);
    
    public void setBeginExceuteTime(Date date);
    
    public Date getBeginExceuteTime();
    
    public void setFinishTime(Date date);
    
    public Date getFinishTime();
}
